<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>#{message.action}</title>
    </h:head>
    <h:body>
        <h3>Enter data:</h3>
        <h:form prependId="false">
            <p>
                Caption: &nbsp;&nbsp;
                <h:inputText value="#{message.caption}" size="10"
                             validatorMessage="Attribute 'Caption' is required">
                    <f:validateRequired/>
                </h:inputText>
            </p>
            <p>
                Post date (dd-MM-yyyy HH:mm:ss):<br/>
                Set current date
                <h:selectBooleanCheckbox id="setCurrentDate" value="#{message.setCurrentDate}"/><br/>
                <h:inputText value="#{message.postDate}"
                             converterMessage="Wrong date format. Date format must look like dd-MM-yyyy HH:mm:ss. Example: 22-09-2011 19:53:47">
                    <f:converter converterId="ru.ssau.managed.SetDateConverter"/>
                </h:inputText>
            </p>
            <p>
                Text:
                <br/>
                <h:inputTextarea rows="4" cols="25" value="#{message.text}"
                                 validatorMessage="Attribute 'Text' is required">
                    <f:validateRequired/>
                </h:inputTextarea>
            </p>
            <p>
                User id: &nbsp;&nbsp;
                <h:selectOneMenu value="#{message.userId}" validatorMessage="Attribute 'User id' is required">
                    <f:selectItems value="#{user.allUsers}"/>
                    <f:validateRequired/>
                </h:selectOneMenu>
            </p>
            <p>
                Thread id: &nbsp;&nbsp;
                <h:selectOneMenu value="#{message.threadId}" validatorMessage="Attribute 'Thread id' is required">
                    <f:selectItems value="#{thread.allThreads}"/>
                    <f:validateRequired/>
                </h:selectOneMenu>
            </p>
            <h:commandButton value="#{message.action}" actionListener="#{message.doAction}" action="#{message.getAction}"/>
        </h:form>
    </h:body>
</html>